package org.ovirt.microvirt.beans.situation;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

@Entity
@XmlRootElement(name = "status")
public class HostStatus {
	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE)
	long id;
	@Column(name = "hostname")
	String hostName;
	@Enumerated
	@Column(name = "state")
	HostState state;
	@Column(name = "lastchk")
	Date lastChecked;
	@Transient
	Date since;
	@Column(name="freemem")
	long freeMemory;

	@XmlAttribute(name = "host")
	public String getHostName() {
		return hostName;
	}

	public void setHostName(String hostName) {
		this.hostName = hostName;
	}

	@XmlAttribute(name = "state")
	public HostState getState() {
		return state;
	}

	public void setState(HostState state) {
		this.state = state;
	}

	@XmlAttribute(name = "lastcheck")
	public Date getLastChecked() {
		return lastChecked;
	}

	public void setLastChecked(Date lastChecked) {
		this.lastChecked = lastChecked;
	}

	@XmlAttribute(name = "since")
	public Date getSince() {
		return since;
	}

	public void setSince(Date since) {
		this.since = since;
	}

	public void setId(long id) {
		this.id = id;
	}

	@XmlTransient
	public long getId() {
		return id;
	}

	public long getFreeMemory() {
		return freeMemory;
	}

	public void setFreeMemory(long freeMemory) {
		this.freeMemory = freeMemory;
	}
}
